@extends('common.base-master')

@section('html-title')
    <title>波罗鸡-{{$title}}</title>
@endsection

@section('html-head')

@endsection

@section('html-body')
    <div class="changeinfo-page">
        <div class="input-con">
            <input type="text" name="info" id="set_value" data-type="{{$type}}" value="{{$content}}" >
            <span class="save-btn">保存</span>
        </div>
    </div>
    <script>
        $(function () {
            $('.save-btn').click(function () {
                var type    = $('#set_value').data('type');
                var content = $('#set_value').val();

                $.ajax({
                    url:"{{route('Api.User.setUserInfo')}}",
                    type:'post',
                    dataType:'json',
                    data:{
                        type:type,
                        content:content
                    },
                    success:function (obj) {
                        if(obj.level == 'success'){
                            $.toast(obj.message,function() {
                                window.location.href="{{route('Home.User.userinfo')}}";
                            });
                        }else {
                            $.toast(obj.message,"forbidden");
                        }
                    },
                    error:function (obj) {
                        console.log(obj);
                    }
                });
            });
        });
    </script>
@endsection